<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	/**
	 * Abstract super exception for all php error enclosing exceptions. Exceptions of subtypes of this
	 * exception are thrown by the TekunaErrorHandler function.
	 *
	 * For reporting issues the file, line and trace are adjusted to cut out the influence of the
	 * intermediate error handler call.
	 */

	abstract class AbstractPHPErrorException extends TekunaException {


		protected function getAdjustedFile() {

			// get the trace
			$arrTrace = $this -> getTrace();

			// the original file is the third argument of the previously called php error handler
			return $arrTrace[0]['args'][2];
		}


		protected function getAdjustedLine() {

			// get the trace
			$arrTrace = $this -> getTrace();

			// the original line is the fourth argument of the previously called php error handler
			return $arrTrace[0]['args'][3];
		}


		protected function getAdjustedTrace() {

			// get the trace
			$arrTrace = $this -> getTrace();

			// return the trace without the first element
			return array_slice($arrTrace, 1);
		}
	}
